/*
* BankService
*
* r2
*
* GNU General Public License v3.0
*/

package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.account.Account;
import com.acme.bankapp.domain.bank.*;
import com.acme.bankapp.domain.client.*;
import com.acme.bankapp.exceptions.*;

public class BankService {

	public void addClient(Bank bank, Client client, Account... accounts) throws ClientExistsException {
		bank.addClient(client);
		
		for(Account a : accounts) {
			client.addAccount(a);
		}
	}
	
	public void printMaximumAmountToWithdraw(Bank bank) {
		int i;
		
		for(Client client : bank.getClients()) {
			System.out.println(client.getClientSalutation() + "'s accounts:");
			i = 1;
			for(Account a : client.getAccounts()) {
				System.out.println("	#" + i + " maximum amount to withdraw: " + a.maximumAmountToWithdraw());
				i++;
			}
		}
	}
	
}
